import pymysql

jwdb = pymysql.connect(host='127.0.0.1',port=3306,user='root',password='123456',db='school_db',charset='utf8')
jwcursor = jwdb.cursor(pymysql.cursors.DictCursor) # 默认元组，pymysql.cursors.DictCursor改为字典

sql = 'INSERT INTO students SET sid = 25123,student_name="worldwind",cid="ST001",height=179;'
result = jwcursor.execute(sql) # 负责执行sql
print(result)
jwdb.commit() # 数据库保存
jwcursor.close()
jwdb.close()